<?
include_once "index.php";

if(isset($submit))
{
	if($submit == 'Search by name')
	{
	$q1 = "select * from job_employer_info where $_POST[name_type] like '%$_POST[name]%' order by $_POST[name_type]";
	$r1 = mysql_query($q1) or die('<center><br><br><br>Select <b>order by </b> option </center>');

		if(mysql_num_rows($r1) == '0')
		{
			echo "<center><br><br><br><span class=BlackText> No results. </span></center>";
			include_once('../footer.php');
			exit;
		}
	}

	if($submit == 'List users')
	{
	$q1 = "select * from job_employer_info order by $_POST[order_type]";
	$r1 = mysql_query($q1) or die('<center><br><br><br> Select <b>order by </b> option </center>');

		if(mysql_num_rows($r1) == '0')
		{
			echo "<center><br><br><br><span class=BlackText> No results. </span></center>";
			include_once('../footer.php');
			exit;
		}
	}

echo "<br><br><table align=center width=460 border=1 rules=rows cellspacing=0 cellpadding=5 bordercolor=black class=BlackText>";
echo "<tr class=TableHead bgcolor=#736F6E><td><font color=#FFFFFF> Username </font></td><td><font color=#FFFFFF>Company Name</font></td> <td align=center><font color=#FFFFFF> Action </font></td></tr>";
$col = "cococo"; 
while($a1 = mysql_fetch_array($r1))
{
 if($col == "cococo")
	    { 
	     $col = "dddddd"; 
	    }
	         	 else
		{ 
		$col = "cococo"; 
		} 

echo "<tr bgcolor=\"$col\"><td> $a1[ename] </td><td><a class=BlackLink href=\"cinfo.php?ename=$a1[ename]\"> $a1[CompanyName] </a></td> <td align=center><a class=BlackLink href=\"ALO.php?ename=$a1[ename]\">list offers</a></td></tr>";
}

echo "</table>";

include_once('../footer.php');

exit;
}

?>



<br>
<form method=post>
<table align=center width=400 class=BlackText>
<tr>
	<td colspan=2 align=center class=HeaderClass><font size=3><b>Explore Employers database </b></font><br><br></td>
</tr>

<table align=center border=1 bordercolor=993300 cellspacing=0 cellpadding=5 width=460>
	<tr>	
		<td align=left><font size=2>Search for an Employer by Company name or username:</font><br><br>
		  <input type=text name=name><br>
	      <input type=radio name=name_type value="CompanyName">Company name&nbsp;&nbsp;
	      <input type=radio name=name_type value="ename">Username&nbsp;&nbsp;<br><br>
	      <input type=submit name=submit value="Search by name">
		</td>
	</tr>
</table>

<br>
<br>

<table align=center border=1 bordercolor=993300 cellspacing=0 cellpadding=5 width=460>
	<tr>
		<td align=left><font size=2>List of all the Employers order by:</font><br><br>

	      <input type=radio name=order_type value="CompanyName">Company name &nbsp;&nbsp;
	      <input type=radio name=order_type value="ename">Username&nbsp;&nbsp;<br><br>
	      <input type=submit name=submit value="List users">
		</td>
	</tr>
</table>

</form>
<? include_once('../footer.php'); ?>